﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Physis.Client.Models.Insurer {

    public class ProgramTypeModel  : Configuration.ConfigurationItemModel {
                
        #region Private Properties

        private Core.Insurer.ProgramType programType = null;

        #endregion


        #region Public Properties

        public override Int64 ConfigurationItemId { set { ProgramTypeId = value; } }

        public override Core.CoreConfigurationObject ConfigurationItem { get { return programType; } }


        public Int64 ProgramTypeId {

            set {

                programType = Application.Core.Insurer.ProgramType (value);

                if (programType == null) {

                    programType = new Core.Insurer.ProgramType (Application);

                }

            }

        }

        public Core.Insurer.ProgramType ProgramType { get { return programType; } set { programType = value; } }

        #endregion 


        #region Constructors

        public ProgramTypeModel (Int64 forProgramTypeId) {

            ProgramTypeId = forProgramTypeId;

            return;

        }

        public ProgramTypeModel (System.Collections.Specialized.NameValueCollection form) {

            UpdateValues (form);

            return;

        }

        #endregion 


        #region Public Methods

        public override void UpdateValues (System.Collections.Specialized.NameValueCollection form) {

            base.UpdateValues (form);

            
            // BASE RELOADS THE ORIGINAL OBJECT TYPE

            ProgramType.Code = Data.Readers.FormReader.StringFromForm (form, "ProgramType.Code");

            return;

        }

        #endregion 

    }

}